<?php
 /******************************************************************************
 *   GunCMS is an avid supporter of open source software. This is the appropriate 
 *   option if you are creating an open source application with a license 
 *   compatible with the GNU GPL license v3.
 *   For details http://www.gnu.org/licenses/gpl.html
 *   DO NOT USE FOR COMMERCIAL WITHOUT PERMISSION
 *
 * GunCMS Version 1.0.3
 * Copyright(c) 2009-2010, T & L GdbR
 * info@guncms.de
 * 
 * http://www.guncms.de
 ********************************************************************************/
class BgcmsConfigManager extends BgcmsProcess {
	var $db;
 	var $smarty;	
	public function __construct($db, $smarty) {
		$this->db = $db;
		$this->smarty = $smarty;
	}
		
	public function __destruct() {
		//
	}
	
	public function edit_config() {
		if ($_POST != "") {
			$cnfdata = BgcmsConfigManagerBean::get_all_config_data($this->db);
			foreach($cnfdata as $item){
				if($_POST['config_value_'.$item->config_key]!=$item->config_key)
				BgcmsConfigManagerBean::update_config_data($this->db,$_POST[$item->config_key],$_POST['config_value_'.$item->config_key]);
			}
			header("Location: ./?module=BgcmsConfigManager");
		}	
	}
	public function process() {
		if(isset($_POST['act'])) {
			$act = $_POST['act'];
			if($act == "updateconfigdata") {
				$this->edit_config();
			}
		}
		$cnfdata = BgcmsConfigManagerBean::get_all_config_data($this->db);
		$this->smarty->assign("CONFIGDATA", $cnfdata);
		$this->Run();
	}
}
?>